<!-- @author Ahmed El-Fouly -->
<?php $this->start('content2');
if (!($accID == null)) { ?>

    <h1>Home Timeline</h1>
    <table><?php foreach ($timeline as $post): ?>
            <tr style="background-color:#FFFFFF"><td>
                    <?php
                    echo $this->Html->image($post['image']) . ' ' . $this->Html->link($post['name'], array('action' => 'viewTweet', $post['screenName'], $post['name'], $post['text'], $post['time']))
                    . ' &nbsp;&nbsp;  ' . $this->Html->link($post['text'], array('action' => 'viewTweet', $post['screenName'], $post['name'], $post['text'], $post['time'])) . "<br />" .
                    $post['time'] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" .
                    $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/reply_hover.png') . $this->Html->link('reply', "javascript:SetReply('@" . $post['screenName'] . "','" . $post['postID'] . "')") . ' ';
                    if (!($post['accID'] == $accID)) {
                        echo $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/retweet_hover.png');
                        if ($post['retweeted'] == false) {
                            echo $this->Html->link('retweet', array('controller' => 'tweets', 'action' => 'retweetPermission', $post['postID'], 1), NULL, 'Are you sure you want to retweet this post ?') . ' ';
                        } else {
                            echo $this->Html->link('undo retweet', array('controller' => 'tweets', 'action' => 'retweetPermission', $post['postID'], 1), NULL, 'Are you sure you want to undo retweet this post ?') . ' ';
                        }
                    }
                    echo $this->Html->image('https://si0.twimg.com/images/dev/cms/intents/icons/favorite_hover.png');
                    if ($post['favorited'] == false) {
                        echo $this->Html->link('favorite', array('controller' => 'Tweets', 'action' => 'favorite', $post['postID'], '1')) . ', ';
                    } else {
                        echo $this->Html->link('unfavorite', array('controller' => 'Tweets', 'action' => 'unfavorite', $post['postID'], 1)) . ', ';
                    }
                    echo $this->Html->link('assign', array('controller' => 'Tasks', 'action' => 'addTask', $post['postID']));
                    ?>

                </td></tr>
        <?php endforeach; ?>
    </table>
<?php } ?>
<?php $this->end(); ?>